package com.lcc.control;

import com.lcc.pojo.Book;
import com.lcc.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpSession;


/**
 * /**
 *
 * @author 廖聪聪
 * @version 1.0
 * 创建时间 2020/7/25 10:16
 */
@Controller
@RequestMapping("/godelsto")
public class DetailsControl {
	@Autowired
	private BookService bookService;
    @RequestMapping(value = "gobuy",method = RequestMethod.GET)
	public String godels(Model model, HttpSession session){
		Object bookid = session.getAttribute("bookid");
		Book book= bookService.findByidBook(new Integer(String.valueOf(bookid)));
		//request.getSession().setAttribute("bookid",bookid);
		model.addAttribute("book",book);
		return "Buy";
	}
}
